#include<iostream>
#include<vector>
using namespace std;

vector<int> f(5050, 0);

int findfa(int x) {
    return f[x] = f[x] == x ? x : findfa(f[x]);
}

int main() {
    int n, m, p;
    cin >> n >> m >> p;
    for(int i=0; i<=n; i++) f[i] = i;
    
    while(m--) {
        int x, y;
        cin >> x >> y;
        x = findfa(x);
        y = findfa(y);
        f[x] = y;
    }
    while(p--) {
        int x, y;
        cin >> x >> y;
        x = findfa(x);
        y = findfa(y);
        if(x == y) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
} 